<template>
  <div class="content">
    <!-- 头部开关 -->
    <div class="header-switch">
      <div :style="{ width: '48%' }">
        <wifiSwitch key="1" title="Wi-Fi" text="Lenovo5G" />
      </div>
      <div :style="{ width: '48%' }">
        <blueToothSwitch key="2" title="蓝牙" text="BOSE SQLL" />
      </div>
    </div>
    <!-- 中上方开关 -->
    <div class="centerTop-switch">
      <div class="left-switch">
        <div class="left-switch-ab">
          <div class="switch-ab" :style="{ marginRight: '10%' }">
            <udsC-Switch
              class="SwitchSize"
              :value="true"
              @change="handleChange"
            >
              <svg-icon
                :style="{ width: 25, height: 25 }"
                icon-class="getScreen"
              >
              </svg-icon>
            </udsC-Switch>
          </div>
          <div class="switch-ab">
            <udsC-Switch
              class="SwitchSize"
              :value="true"
              @change="handleChange"
            >
              <svg-icon
                :style="{ width: 25, height: 25 }"
                icon-class="airplaneMode"
              >
              </svg-icon>
            </udsC-Switch>
          </div>

          <div
            class="switch-ab"
            :style="{ marginRight: '10%', marginTop: '10%' }"
          >
            <udsC-Switch
              class="SwitchSize"
              :style="{ width: '100%', height: '100%' }"
              :value="true"
              @change="handleChange"
            >
              <svg-icon
                :style="{ width: 25, height: 25 }"
                icon-class="nightMode"
              >
              </svg-icon>
            </udsC-Switch>
          </div>

          <div class="switch-ab" :style="{ marginTop: '10%' }">
            <udsC-Switch
              class="SwitchSize"
              :value="true"
              @change="handleChange"
            >
              <svg-icon
                :style="{ width: 25, height: 25 }"
                icon-class="silentMode"
              >
              </svg-icon>
            </udsC-Switch>
          </div>
        </div>
      </div>
      <div class="right-switch">
        <div class="right-switch-ab">
          <rectSwitch title="省电模式" text=""></rectSwitch>
          <rectSwitch title="位置信息" text=""></rectSwitch>
        </div>
      </div>
    </div>
    <!-- 中下方开关 -->
    <div class="centerBottom-switch">
      <div class="bottom-switch-item">
        <udsSlider :value="value" class="slider-left">
          <svg-icon :style="{ width: 15, height: 15 }" icon-class="light">
          </svg-icon>
        </udsSlider>
        <udsC-Switch
          class="slider-right"
          :width="30"
          :height="30"
          :value="true"
          @change="handleChange"
        >
          <svg-icon
            :style="{ width: 15, height: 15 }"
            icon-class="lightSetting"
          >
          </svg-icon>
        </udsC-Switch>
      </div>
      <div class="bottom-switch-item" :style="{ marginTop: '25px' }">
        <udsSlider :value="value" class="slider-left">
          <svg-icon :style="{ width: 15, height: 15 }" icon-class="sound">
          </svg-icon>
        </udsSlider>
        <udsC-Switch
          class="slider-right"
          :width="30"
          :height="30"
          :value="true"
          @change="handleChange"
        >
          <svg-icon
            :style="{ width: 15, height: 15 }"
            icon-class="soundSetting"
          >
          </svg-icon>
        </udsC-Switch>
      </div>
    </div>
    <!-- 下方头像部分 -->
    <div class="bottom-switch">
      <img class="bottom-switch-photo" :src="profile" alt="" />
      <p class="bottom-switch-text">Vincent</p>
      <div class="bottom-switch-setting">
        <udsC-Switch
          class="slider-right"
          :width="50"
          :height="50"
          :value="true"
          @change="handleChange"
        >
          <svg-icon :style="{ width: 30, height: 30 }" icon-class="setting">
          </svg-icon>
        </udsC-Switch>
        <udsC-Switch
          class="slider-right"
          :width="52"
          :height="52"
          :value="true"
          @change="handleChange"
        >
          <svg-icon :style="{ width: 30, height: 30 }" icon-class="close">
          </svg-icon>
        </udsC-Switch>
      </div>
    </div>
  </div>
</template>
<script>
import blueToothSwitch from './components/blueToothSwitch.vue';
import wifiSwitch from './components/wifiSwitch.vue';
import rectSwitch from './components/rectSwitch.vue';

const profile = require('@/static/img/profile.jpg');

export default {
  name: 'index',
  props: {},
  data() {
    return {
      value: 10,
      profile,
    };
  },
  components: {
    blueToothSwitch,
    wifiSwitch,
    rectSwitch,
  },
  methods: {
    handleChange() {},
    submit(done) {
      // setTimeout 模拟异步请求
      setTimeout(() => {
        done();
      }, 2000);
    },
  },
};
</script>
<style lang='scss' >
.content {
  padding: 4%;
  background-color: #ffffff;
}
.header-switch {
  display: flex;
  justify-content: space-between;
}
.centerTop-switch {
  margin-top: 20px;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  .is-circle { //todo 韦林修改完组件样式可去掉此代码
    width: 100% !important;
    height: 100% !important;
  }
}
.left-switch {
  position: relative;
  width: 48%;
  padding-top: 48%;
  background-color: #f0f3f8;
  float: left;
  border-radius: 8px;
}
.right-switch {
  overflow: hidden;
  background-color: #ffffff;
  border-radius: 8px;
  width: 48%;
  padding-top: 48%;
  position: relative;
  .right-switch-ab {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

  }
}
.left-switch-ab {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
}

.left-switch-wrap {
  display: flex;
  justify-content: center;
}
.switch-ab {
  width: 34%;
  padding-top: 34%;
  position: relative;
}
.content .SwitchSize {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex !important; //todo暂时使用 等韦林把id定义的class改完就ok 了
  justify-content: center;
  align-items: center;
}
.centerBottom-switch {
  margin-top: 20px;
  background-color: #f0f3f8;
  border-radius: 8px;
  padding: 6% 2% 6% 6%;
}
.bottom-switch-item {
  display: flex;
}
.slider-left {
  flex: 1;
}
.slider-right {
  margin-left: 10px;
}
.bottom-switch {
  display: flex;
  align-items: center;
  height: 104px;
  margin-top: 30px;
  border-radius: 8px;
  padding: 6% 6% 6% 6%;
}
.bottom-switch-text {
  // flex:1;
  // min-width: 0;
  text-align: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-switch-photo {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background-color: #000000;
  margin-right: 16px;
}
.bottom-switch-setting {
  display: flex;
  flex: 1;
  justify-content: flex-end;
}
</style>
